package com.zhiyou100.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou100.mapper.SubjectMapper;
import com.zhiyou100.model.Course;
import com.zhiyou100.model.Speaker;
import com.zhiyou100.model.Subject;
import com.zhiyou100.model.Video;
import com.zhiyou100.service.SubjectService;
@Service
public class SubjectServiceImpl implements SubjectService{
	@Autowired
	private SubjectMapper sm;

	@Override
	public Subject selectSubjects(Integer subject_id) {
		Subject subject = sm.selectBySubjectId(subject_id);
		subject.setId(subject_id);
		List<Course> courses = subject.getCourse();
		for (Course course : courses) {
			List<Video> videos = course.getVideo();
			for (Video video : videos) {
				Speaker speaker = video.getSpeaker();
			}
		}
		return subject;
	}

	@Override
	public Subject selectSubject(Integer subject_id) {
		
		return sm.selectBySubjectId(subject_id);
	}

	@Override
	public List<Subject> selectSubjectName() {
		
		return sm.selectBySubjectName();
	}
	
}
